# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-simplejson
pkgver=3.19.3
pkgrel=0
pkgdesc="Simple, fast, extensible JSON encoder/decoder for Python"
url="https://github.com/simplejson/simplejson"
arch="all"
license="MIT"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
subpackages="$pkgname-pyc"
source="https://github.com/simplejson/simplejson/archive/refs/tags/v$pkgver/simplejson-v$pkgver.tar.gz"
builddir="$srcdir"/simplejson-$pkgver

provides="py-simplejson=$pkgver-r$pkgrel" # backwards compatibility
replaces="py-simplejson" # backwards compatiblity

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python*/site-packages/simplejson/tests/
}

sha512sums="
18fda36f88ef0a3e450707687a4289a1c8e2d5f45267ce9c2e4994e1b19736c7d0e273cbb1825a62693c747d8e8089683d2f47943fb17a945642d954b694e35b  simplejson-v3.19.3.tar.gz
"
